#
# @lc app=leetcode.cn id=122 lang=python3
#
# [122] 买卖股票的最佳时机 II
#

# @lc code=start
class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        if len(prices) == 0:
            return 0
        result = 0
        lastPrice = prices[0]    
        for currentPrice in prices:
            if currentPrice > lastPrice:
                result += currentPrice - lastPrice
            lastPrice = currentPrice
                
        return result
       
# @lc code=end

